package routes

import (
	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
	"rabbit_love/src/utils"
)

func MountRoute(g *echo.Group) {
	g.Use(utils.RequestCORS())

	// 添加请求日志
	g.Use(middleware.LoggerWithConfig(
		middleware.LoggerConfig{
			Format: "method=${method}, uri=${uri}, path=${path}, status=${status}, \n",
		}))
	// 挂载用户接口
	UserApi(g.Group("/user"))

	g.Use(utils.CheckToken)
	// 挂载数据接口
	DataApi(g.Group("/data"))

	// 挂载聊天接口
	ChatApi(g.Group("/chat"))
}
